import { CHANNEL_SAVE_LIST, CHANNEL_UPDATE_ID } from '../action/actionTypes';

// rxreducer 快捷键快速创建
const initialState = {
  channelsList: [],
  currentId: 0,
};

// 不建议导出没有名字的函数，手动修改为 function 导出
export default function channelReducer(
  state = initialState,
  { type, payload }
) {
  // console.log('type -----> ', type);
  switch (type) {
    case CHANNEL_SAVE_LIST:
      return { ...state, channelsList: payload };
    case CHANNEL_UPDATE_ID:
      return { ...state, currentId: payload };

    default:
      return state;
  }
}
